<!DOCTYPE html>
<html class="ui-page-login">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title></title>
    <script src="__PUBLIC__/js/jquery.min.js"></script>
    <script src="__PUBLIC__/common.js"></script>
    <script src="__PUBLIC__/home/plugins/layer/layer.js"></script>
    <script src="__PUBLIC__/mui/js/mui.min.js"></script>
    <script src="__PUBLIC__/js/angular.js"></script>
    <link rel="stylesheet" href="__PUBLIC__/mui/css/mui.css">
    <style>
        #member-login{
            display: none;
        }
        .area {
            margin: 20px auto 0px auto;
        }

        .mui-input-group {
            margin-top: 10px;
        }

        .mui-input-group:first-child {
            margin-top: 20px;
        }

        .mui-input-group label {
            width: 22%;
        }

        .mui-input-row label~input,
        .mui-input-row label~select,
        .mui-input-row label~textarea {
            width: 78%;
        }

        .mui-checkbox input[type=checkbox],
        .mui-radio input[type=radio] {
            top: 6px;
        }

        .mui-content-padded {
            margin-top: 25px;
        }

        .mui-btn {
            padding: 10px;
        }

        .link-area {
            display: block;
            margin-top: 25px;
            text-align: center;
        }

        .spliter {
            color: #bbb;
            padding: 0px 8px;
        }

        .oauth-area {
            position: absolute;
            bottom: 20px;
            left: 0px;
            text-align: center;
            width: 100%;
            padding: 0px;
            margin: 0px;
        }

        .oauth-area .oauth-btn {
            display: inline-block;
            width: 50px;
            height: 50px;
            background-size: 30px 30px;
            background-position: center center;
            background-repeat: no-repeat;
            margin: 0px 20px;
            /*-webkit-filter: grayscale(100%); */
            border: solid 1px #ddd;
            border-radius: 25px;
        }

        .oauth-area .oauth-btn:active {
            border: solid 1px #aaa;
        }

        .oauth-area .oauth-btn.disabled {
            background-color: #ddd;
        }
        .login-active{
            background:#f3363a ;
        }
        .mui-input-row label{
            width: 35%;
        }
        .mui-input-row label~input, .mui-input-row label~select, .mui-input-row label~textarea {
            width: 65%;
        }
    </style>

</head>

<body ng-app="myApp" ng-controller="Ctrl" ng-cloak>
<header class="mui-bar mui-bar-nav" style="background:#f3363a;">
    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left" style="color: white"></a>
  <!--  <a class="mui-icon  mui-pull-right toggle" style="color: white;font-size: 14px;line-height: 44px;margin: 0;padding: 0">代理登录</a>-->
    <h1 class="mui-title login-item" style="color: white">修改密码</h1>
</header>
<div class="mui-content" id="user-login" style="padding-top: 54px">
    <form  class="mui-input-group"method="post" action="" style="margin-top: 0">

        <div class="mui-input-row">
            <label>原密码</label>
            <input name='oldpwd' id="oldpwd" type="password" class="mui-input-clear mui-input" placeholder="请输入原密码" ng-model="oldpwd">
        </div>
        <div class="mui-input-row">
            <label>新密码</label>
            <input name='newpwd1' id="newpwd1" type="password" class="mui-input-clear mui-input" placeholder="请输入新密码" ng-model="newpwd1">
        </div>
        <div class="mui-input-row">
            <label>确认密码</label>
            <input name='newpwd2' id="newpwd2" type="password" class="mui-input-clear mui-input" placeholder="确认新密码" ng-model="newpwd2">
        </div>
    </form>
    <div class="mui-content-padded">
        <button id='login' class="mui-btn mui-btn-block mui-btn-danger" style="line-height: 1"  ng-click="sub()">确认修改</button>
        </div>
    </div>
    <div class="mui-content-padded oauth-area">
    </div>
</div>

<script>
    var app = angular.module('myApp', []);
    app.controller('Ctrl', function($scope,$http) {

        $scope.sub=function () {
            var old = $("#oldpwd").val();
            var new1 = $("#newpwd1").val();
            var new2 = $("#newpwd2").val();

            $http({
                method:'POST',
                data:{"old":old,"new1":new1,"new2":new2},
                headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
                transformRequest: function(obj) {
                    var str = [];
                    for (var p in obj) {
                        str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
                    }
                    return str.join("&");
                },
                url: "/Home/Member/changePasswd"
            }).then(function successCallback(response) {
                if(response.data.code== -1){
                    layer.msg(response.data.msg);
                }else {
                    layer.msg(response.data.msg);
                    setTimeout(function () {
                        window.location.href = "/Home/member/member";
                    }, 1000)
                }
            }, function errorCallback(response) {

            });
        }
    })
    /*代理登录*/
   $(".login-tab>div").click(function () {

       $(this).siblings("div").removeClass("login-active").find("input").attr("disabled",true);
       $(this).addClass("login-active").find("input").attr("disabled",false);

   })
</script>
</body>
</html>
